package com.cheng.controller;

import com.cheng.common.results.DataRslt;
import com.cheng.common.utils.CodeUtil;
import com.cheng.data.vo.ReqPageInfoVO;
import com.cheng.data.vo.RespPageInfoVO;
import com.cheng.operation.AcceptInfoOperation;
import com.cheng.operation.BorrowOperation;
import com.cheng.operation.CompanyInfoOperation;
import com.cheng.operation.CompanyMoveInfOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author: ChengJW
 * @date: 2021/12/19 16:59
 * @version: 1.0
 * @description:
 */
@Controller
public class StatisticsController extends BaseController{

    private final static Logger log = LoggerFactory.getLogger(StatisticsController.class);

    @Autowired
    private CompanyInfoOperation companyInfoOperation;

    @Autowired
    private AcceptInfoOperation acceptInfoOperation;

    @Autowired
    private CompanyMoveInfOperation companyMoveInfOperation;

    @Autowired
    private BorrowOperation borrowOperation;

    @RequestMapping("/statistics/statisticsqiYe")
    public String statisticsqiYe(){
        return "statisticsqiYe";
    }

    @RequestMapping("/statistics/statisticsdangAn")
    public String statisticsdangAn(){
        return "statisticsdangAn";
    }

    @RequestMapping("/statistics/statisticsshouLi")
    public String statisticsshouLi(){
        return "statisticsshouLi";
    }

    @RequestMapping("/statistics/statisticsqianYi")
    public String statisticsqianYi(){
        return "statisticsqianYi";
    }

    @RequestMapping("/statistics/statisticsjieYue")
    public String statisticsjieYue(){
        return "statisticsjieYue";
    }
    /**
    * @author: ChengJW
    * @params: [pageInfoVO]
    * @return: com.cheng.common.results.DataRslt
    * @date: 2021/12/19
    * @description: 查询统计数据
    */
    @RequestMapping("/statistics/statisticsCom/queryStatisticsDataList")
    @ResponseBody
    public DataRslt queryStatisticsDataList(ReqPageInfoVO pageInfoVO) {
        String condition = (String) pageInfoVO.getQryReqFir();
        RespPageInfoVO respPageInfoVO = new RespPageInfoVO();
        if (CodeUtil.QI_YE.equals(condition)){
            respPageInfoVO = companyInfoOperation.queryStatisticsVOList(pageInfoVO);
        }else if (CodeUtil.SHOU_LI.equals(condition)){
            respPageInfoVO = acceptInfoOperation.queryStatisticsAcceptList(pageInfoVO);
        }else if (CodeUtil.DANG_AN.equals(condition)){
            respPageInfoVO = companyInfoOperation.queryStatisticsArchVOList(pageInfoVO);
        }else if (CodeUtil.QIAN_YI.equals(condition)){
            respPageInfoVO = companyMoveInfOperation.queryStatisticsMvVOList(pageInfoVO);
        }else if (CodeUtil.JIE_YUE.equals(condition)){
            respPageInfoVO = borrowOperation.queryStatisticsBrowVOList(pageInfoVO);
        }
        return tabSuccess(respPageInfoVO);
    }
}
